package com.cosc716.application.gui;

import java.awt.BorderLayout;
import javax.swing.JFrame;
import com.cosc716.application.gui.components.ManagementPanel;
import com.cosc716.restaurant.system.SystemInterface;
import com.cosc716.simulator.Simulator;

public class GUI {
	private Simulator simulator;
	private SystemInterface systemInterface;
	JFrame guiFrame;

	public GUI() {
		if(simulator == null) {
			simulator = new Simulator();
		}
		
		if(systemInterface == null) {
			systemInterface = SystemInterface.getInstance();
		}
	}
	
	public void run() {
		createAndShowGUI();
	}

	private void createAndShowGUI() {
		guiFrame = new JFrame("COSC 716 Restuarant Simulator");
		guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		// Set up the Manager panel
		ManagementPanel mp = new ManagementPanel(systemInterface, simulator);
						
		// Add the panel to the frame
		guiFrame.getContentPane().add(mp, BorderLayout.CENTER);
		
		guiFrame.pack();
		guiFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
		guiFrame.setVisible(true);
	}

}

